package com.hqyj.product.service.impl;

import com.hqyj.product.mapper.GoodInfoMapper;
import com.hqyj.product.model.GoodInfo;
import com.hqyj.product.service.GoodInfoService;
import com.hqyj.repertory.mapper.OutRepertoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodInfoServiceImpl implements GoodInfoService {

    @Autowired
    private GoodInfoMapper goodInfoMapper;
    @Autowired
    private OutRepertoryMapper outRepertoryMapper;

    @Override
    public List<GoodInfo> queryAllGoodInfo() {
        return goodInfoMapper.queryAllGoodInfo();
    }

    @Override
    public int addGoodInfoByGoodInfo(GoodInfo goodInfo) {
        return goodInfoMapper.insertSelective(goodInfo);
    }

    @Override
    public int deleteGoodInfoById(int id) {
        return goodInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public GoodInfo queryGoodInfoById(int goodInfoId) {
        return goodInfoMapper.selectByPrimaryKey(goodInfoId);
    }

    @Override
    public int updateGoodInfoByGoodInfo(GoodInfo goodInfo) {
        return goodInfoMapper.updateByPrimaryKeySelective(goodInfo);
    }

    @Override
    public int insertOutRepertoryByGoodInfo(String tradeName, Integer pickingQuantity, String type) {
        return outRepertoryMapper.insertOutRepertoryByGoodInfo(tradeName,pickingQuantity,type);
    }

    @Override
    public void updateGoodInfoStateByGoodInfo(Integer idStr) {
        goodInfoMapper.updateGoodInfoStateByGoodInfo(idStr);
    }
}
